package com.d3works.apps.sale.service.configurator;

import com.d3works.apps.sale.db.ConfiguratorCreator;
import com.d3works.apps.sale.db.ConfiguratorFormula;
import com.d3works.exception.D3worksException;

public interface ConfiguratorFormulaService {

  String PARENT_SALE_ORDER_ID_FIELD_NAME = "parentSaleOrderId";

  /**
   * Check if the written formula is valid.
   *
   * @param formula
   * @param creator
   */
  void checkFormula(ConfiguratorFormula formula, ConfiguratorCreator creator)
      throws D3worksException;

  /**
   * Get the name of the given object. Use EntityHelper to get the right class name for proxy
   * classes.
   *
   * @param calculatedValue a result from groovy script.
   * @return the name of the class.
   */
  String getCalculatedClassName(Object calculatedValue);
}
